#!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of cjklib.
#
# cjklib is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# cjklib is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with cjklib.  If not, see <http://www.gnu.org/licenses/>.

"""
Provides unit tests.
"""

__all__ = ['readingoperator', 'readingconverter', 'characterlookup', 'attr']

from cjklib.util import getConfigSettings
from cjklib.dbconnector import DatabaseConnector

try:
    from nose.plugins.attrib import attr
except ImportError:
    # dummy decorator
    def attr(attrName):
        return lambda x: x

class NeedsDatabaseTest:
    """Base class for unit test with database access"""

    def setUp(self):
        # make sure we use the default config settings and overwrite any
        #  instance generated by the test.build unit tests
        configuration = getConfigSettings('Connection')
        self.db = DatabaseConnector.getDBConnector(configuration)
